package com.tarena.lbs.user.dao.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tarena.lbs.user.dao.mapper.UserTagsMapper;
import com.tarena.lbs.user.dao.repository.UserTagsRepository;
import com.tarena.lbs.user.pojo.po.UserTagsPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class UserTagsRepositoryImpl implements UserTagsRepository {
    @Autowired
    private UserTagsMapper userTagsMapper;

    @Override
    public void save(UserTagsPO userTagsPO) {
        userTagsMapper.insert(userTagsPO);
    }

    @Override
    public void deleteByUserId(Integer userId) {
        QueryWrapper<UserTagsPO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        userTagsMapper.delete(queryWrapper);
    }
}
